package com.fresh.auth.controller;

import com.fresh.auth.Service.RoleService;
import com.fresh.common.ResponseResult;
import com.fresh.entity.Role;
import com.fresh.entity.RolePermissionVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/role")
public class RoleController {
    @Autowired
    RoleService roleService;

    @GetMapping("/getAll")
    public Object getAll(){
        List<Role> roles = roleService.getAll();
        return new ResponseResult<>(200,"",roles);
    }

    @PostMapping("/update")
    public Object update(@RequestBody RolePermissionVO rolePermissionVO){
        roleService.update(rolePermissionVO);
        return  new ResponseResult<>(200,"",null);
    }
}
